package io;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

public class OOSDemo {
    public static void main(String[] args) throws Exception {
        //对象流在序列化时  必须保证序列化对象必须实现Serializable 没有实现会报错
        String name="张三";
        int age=25;
        String gender="男";
        String[] otherinfo={"是一名学生","黑龙江佳木斯的","爱打篮球","喜欢美女"};
        Student zs=new Student(name,age,gender,otherinfo);
        System.out.println(zs);

        FileOutputStream fos=new FileOutputStream("Student.obj");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(zs);
        System.out.println("写出完毕");
        oos.close();

    }
}
